//
//  Defines.h
//  yingke-wlan
//
//  Created by FranklinPhill on 15/4/15.
//  Copyright (c) 2015年 maipu. All rights reserved.
//

#import <Foundation/Foundation.h>

#pragma mark - 宏定义

#ifdef DEBUG
#define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define DLog(...)
#endif

//系统定义
#define DEFAULT_NAS_IP @"115.28.38.73:8080"
#define NAS_IP @"115.28.38.73"
#define APNS_ID @"1" //用于提交Apns所使用的一个字段
#define APP_KEY @"fe4c136addc744bf8ab7845a962d2289"
#define UMENG_APP_KEY @"551c96a4fd98c50bf90010e3"   //友盟统计AppKey
#define UMENG_APP_SECRET @"yz1iipmn3bxdwsa5lpzcgcnl8w7nerby"    //友盟消息推送secret
#define APP_VERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey] //bundle version
#define KEYCHAIN_SERVICE @"com.maipu.yingke-wlan"    //keychain id
#define WX_PUBLIC_ID @"gh_16d09b705b13"    //迎客商家微信公众号原始ID
#define WX_APP_ID @"wx1cf750b147235760"   //迎客商家绑定微信开放平台的scheme
#define MAIPU_SERVICE_PHONE @"tel://4000859879"    //服务热线
//通过比较bundle version和NSUserDefaults中记录的version来推断当前是否是安装&更新之后的首次使用该app, true:初次（或者升级） false:非初次
//当启动页面加载出以后，该参数为false
#define IS_FIRST_LOAD ![[[AKUserDefaults sharedInstance] versionString] isEqualToString:APP_VERSION]

//工具
#define APPDELEGATE (AppDelegate *)[[UIApplication sharedApplication] delegate]
#define StoryBoard(storyId) [UIStoryboard storyboardWithName:storyId bundle:nil]    //StoryBoard
#define IMAGE(imageName) [UIImage imageNamed:imageName]  //UIImage
#define RGBColor(r, g, b) [UIColor colorWithRed:(r)/255.f green:(g)/255.f blue:(b)/255.f alpha:1.f] //UIColor

//尺寸
#define IOS6 ([[UIDevice currentDevice].systemVersion floatValue] >= 6.0 ? YES : NO)
#define IOS7 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7)
#define IOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8)
#define iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define iPhone6plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (CGSizeEqualToSize(CGSizeMake(1125, 2001), [[UIScreen mainScreen] currentMode].size) || CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size)) : NO)
#define iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define kAppViewWidthIP4_IP5 320.f
#define kAppViewWidthIP6 375.f
#define kAppViewWidthIP6P 414.f
#define kAppViewHeightIP4 480.f
#define kAppViewHeightIP5 568.f
#define kAppViewHeightIP6 667.f
#define kAppViewHeightIP6P 736.f
#define kTitleBarHeight 64.f
#define kNaviItemYIOS6 10.f
#define kNaviItemYIOS7 19.f
#define kContentInsetsTop 100.f
#define kViewWidth self.view.frame.size.width
#define kViewHeight self.view.frame.size.height
#define UIScreenBounds [[UIScreen mainScreen] bounds]
//tabbar配置  注意  一级菜单名称不要重复
#define TabBarHeight  49.0
#define popMenuHeight 200.0
#define menuCount 10
#define selected_index 0  //一级菜单默认选中第几个
#define MAX_TAB_COUNT 4
#define MAX_IMAGEPIX 680.0          // max pix 200.0px
#define MAX_IMAGEDATA_LEN 50000.0   // max data length 5K

//UI
#define Button_BackgroundColor_Highlighted_Gray RGBColor(225, 225, 225) //按钮灰色高亮
#define Button_BackgroundColor_Highlighted_Blue [XZCommonUtil colorWithHexString:@"0066aa"]

//文本
#define Alert_Title_Note        @"提示"
#define Button_Title_Cancel     @"取消"
#define Button_Title_Confirm    @"确定"
#define MESSAGE_LOADING         @"加载中..."
#define MESSAGE_WAITING         @"请稍候..."
#define MESSAGE_SYSTEM_ERROR    @"系统错误"

//通知
#define UserLoginNotification   @"UserLoginNotification"    //登录
#define UserLogoutNotification  @"UserLogoutNotification"   //登出
#define UserModifyNotification  @"UserModifyNotification"   //添加修改删除账号
#define UpdateDeviceNotification @"UpdateDeviceNotification"    //修改设备

#pragma mark - 枚举

//角色(登录后返回)
typedef NS_ENUM(NSInteger, UserRole) {
    UserRoleMerchantOwner = 31,         //户主
    UserRoleMerchantDevice = 32,        //设备管理员
    UserRoleMerchantContent = 33,       //内容管理员
    UserRoleMerchantContentExamine = 34 //内容审核员
};

//app启动的状态
typedef NS_ENUM(NSInteger, AKAppState) {
    AKAppStateNormal = 0,   //普通
    AKAppStateFirstUse,     //初次使用
    AKAppStateUpgrade,      //升级
};

//左侧抽屉菜单类型
typedef NS_ENUM(NSInteger, LeftDrawerButton) {
    LeftDrawerButton_Background = 0,  //背景按钮
    LeftDrawerButton_Login = 1,       //登录
    LeftDrawerButton_Logout = 2,      //注销
    LeftDrawerButton_Index = 3,        //首页
    LeftDrawerButton_Settings = 4,    //设置
    LeftDrawerButton_MsgCenter = 5,   //消息中心
    LeftDrawerButton_Help = 6,        //帮助
    LeftDrawerButton_CheckNew = 7,    //检查新版本
    LeftDrawerButton_AboutUs = 8,     //关于
};
